package com.axxc.jpa.pattendegign.commons;

import com.axxc.jpa.pattendegign.composite.Employee;

/**
 * @ClassName TestComposite
 * @Description //TODO 请描述该类的作用
 * @author xxc
 * @data 2018年9月10日下午9:15:09
 * @see {@link http://gitee.com/biuabiu/ }
 */
public class TestCompositePatten {

	public static void main(String[] args) {
		Employee CEO = new Employee("John", "CEO");

		Employee headSales = new Employee("Robert", "Head Sales");
		Employee headMarketing = new Employee("Michel", "Head Marketing");
		CEO.add(headSales);
		CEO.add(headMarketing);

		Employee clerk1 = new Employee("Laura", "Marketing");
		Employee clerk2 = new Employee("Bob", "Marketing");

		Employee salesExecutive1 = new Employee("Richard", "Sales");
		Employee salesExecutive2 = new Employee("Rob", "Sales");
		headSales.add(salesExecutive1);
		headSales.add(salesExecutive2);



		headMarketing.add(clerk1);
		headMarketing.add(clerk2);

		// 打印该组织的所有员工
		System.out.println(CEO);
		
		for (Employee headEmployee : CEO.getSubordinates()) {
			System.out.println(headEmployee);
			for (Employee employee : headEmployee.getSubordinates()) {
				System.out.println(employee);
			}
		}
	}

}
